#!/usr/bin/python
# -*- coding: UTF-8 -*-

import tkinter as tk

# 创建窗体
window = tk.Tk()
window.title('Tk Demo')
window.geometry('350x500')

l = tk.Label(
    window,
    bg='yellow',
    width=4,
)
l.pack()
count = 0


def do_job():
    global count
    l.config(text=str(count))
    count += 1
    pass


menubar = tk.Menu(window)
filemenu = tk.Menu(menubar, tearoff=0)

menubar.add_cascade(label='File', menu=filemenu)
filemenu.add_command(label='New', command=do_job)
filemenu.add_command(label='Open', command=do_job)
filemenu.add_command(label='Save', command=do_job)

filemenu.add_separator()
submenu = tk.Menu(filemenu)
filemenu.add_cascade(label='Import', menu=submenu)
submenu.add_command(label='submenu', command=do_job)

filemenu.add_separator()
filemenu.add_command(label='Exit', command=window.quit)

window.config(menu=menubar)

window.mainloop()

